package com.mtons.mblog.modules.repository;

import com.mtons.mblog.modules.entity.History;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * HistoryRepository.
 * @author yuzhong
 * @date 2019/2/22 13:45
 */
public interface HistoryRepository extends JpaRepository<History, Integer>, JpaSpecificationExecutor<History> {

    @Query(value = "select id,title,year,month,day,content from miu_history where month = extract(month from current_timestamp) and day = extract(day from current_timestamp) order by year desc", nativeQuery = true)
    public List<History> findByToday();

}
